package com.jc.gateway.enums;

import lombok.Getter;

/**
 * @Description: 响应码枚举
 * @Author: ASL_ly
 * @Package: com.jc.subject.common.enums
 * @Project: jc-club
 * @Date: 2024/10/21  20:10
 */
@Getter
public enum ResultCodeEnum {
    SUCCESS(200, "成功"),
    FAIL(500, "失败");
    public Integer code;
    public String desc;

    ResultCodeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(Integer codeVal){
        for(ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()){
            if(resultCodeEnum.code == codeVal){
                return resultCodeEnum;
            }
        }
        return null;
    }

}
